package com.sitr.house.controller;

import com.sitr.house.common.model.House;
import com.sitr.house.service.RecommandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @Description TODO
 * @Author Sitr
 * @Date 2020/12/5 14:53
 * @Version 1.0
 **/


@Controller
public class HomePageController {

    @Autowired
    private RecommandService recommandService;


    @RequestMapping("index")
    public String index(ModelMap modelMap) {
        List<House> houses = recommandService.getLastest();
        modelMap.put("recomHouses", houses);
        return "homepage/index";
    }


    @RequestMapping("")
    public String home(ModelMap modelMap) {
        return "redirect:/index";
    }
}
